import Vue from 'vue';
import Vuex from 'vuex';
import Fn from '@/common/public.js';
Vue.use(Vuex);
const store = new Vuex.Store({
	state: {
		token: '', // 用户token
		// baseUrl: 'http://testows.jiushuntang.cn', // 测试服域名
		// baseUrl: 'http://ows.gdjstnet.com', // 正式服域名
		baseUrl: 'http://yijiagou.weiyintest.com',
	},
	mutations: {
		/* 获取手机顶部导航栏高度 */
		getBarHeight() {
			uni.getSystemInfo({
				success: function(e) {
					Vue.prototype.statusBar = e.statusBarHeight;
					
					// #ifndef MP
					if (e.platform == 'android') {
						Vue.prototype.customBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.customBar = e.statusBarHeight + 45;
					};
					// #endif

					// #ifdef MP-WEIXIN
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight;
					// #endif

					// #ifdef MP-ALIPAY
					Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				}
			});
		},
	},
	actions: {
		
	}
});

export default store;
